package prototype.phase2.ui;

import java.io.IOException;

import com.jmex.audio.AudioTrack;
import com.jmex.audio.openal.OpenALStreamedAudioPlayer;
import com.jmex.audio.player.StreamedAudioPlayer;

class DynamicAudioTrack extends AudioTrack {

    private StreamedAudioPlayer stream;

    public DynamicAudioTrack() {
        // supply dummy URL for superclass
        super(DynamicAudioStream.class.getClassLoader().getResource("."),
                true);

        try {
            this.stream = new OpenALStreamedAudioPlayer(
                    new DynamicAudioStream(), this);
            stream.init();
        } catch (IOException e) {
            e.printStackTrace();
            return;
        }

        setPlayer(stream);

        setEnabled(true);

        setType(TrackType.ENVIRONMENT);
        setRelative(true);
        setTargetVolume(0.9F);
    }
}